#include <stdio.h>
#include <stdlib.h>

typedef struct step//记录每一步的两个数据
{
    int e1;
    int e2;
}step;

int addcmp(const void* e1, const void* e2)
{
    return **(int**)e1 - **(int**)e2;
}

int main()
{
    int n = 0, m = 0;//m为计数器
    scanf("%d", &n);
    int flag = 1;
    int* arr = (int*)malloc(sizeof(int) * n);
    int** add = (int**)malloc(sizeof(int*) * n);
    step* mstep = (step*)malloc(sizeof(step) * (2*n));
    for(int i = 0; i < n; i++)
    {
        scanf("%d", &arr[i]);
        if(i > 0&&arr[i] < arr[i-1])
        flag = 0;
        add[i] = &arr[i];
    }
    if(flag)
    {
        printf("%d\n", m);
        return 0;
    }
    qsort(add, n, sizeof(int*), addcmp);
    if((*add[n-1]) + (*add[0]) >= 0)//最大值的绝对值较大或全为正数
    {
        for(int i = 0; i < n-1; i++)//遍历arr数组并调整;
        {
            if(arr[i] > arr[i+1])
            {
                if(arr[i+1] + *add[n-1] < arr[i])//加最大的数都没效果
                {
                    arr[i+1] += *add[n-1];
                    mstep[m].e1 = add[n-1] - arr;
                    mstep[m].e2 = i + 1;
                    m++;
                    qsort(add, n, sizeof(int*), addcmp);
                }
                for(int j = n - 1; j >= -1; j--)
                {
                    if(j == -1 || arr[i+1] + *add[j] < arr[i])
                    {
                        arr[i+1] += *add[j+1];
                        mstep[m].e1 = add[j+1] - arr;
                        mstep[m].e2 = i + 1;
                        m++;
                        qsort(add, n, sizeof(int*), addcmp);
                        break;
                    }
                }
            }
        }
    }
    else//最小值的绝对值较大或全为负数
    {
        for(int i = n - 2; i >= 0; i--)//遍历arr数组并调整;
        {
            if(arr[i] > arr[i+1])
            {
                if(arr[i] + *add[0] > arr[i+1])//加最小的负数都没用
                {
                    arr[i] += *add[0];
                    mstep[m].e1 = add[0] - arr;
                    mstep[m].e2 = i;
                    m++;
                    qsort(add, n, sizeof(int*), addcmp);
                }
                for(int j = 0; j <= n; j++)
                {
                    if(j == n || arr[i] + *add[j] > arr[i+1])
                    {
                        arr[i] += *add[j-1];
                        mstep[m].e1 = add[j-1] - arr;
                        mstep[m].e2 = i;
                        m++;
                        qsort(add, n, sizeof(int*), addcmp);
                        break;
                    }
                }
            }
        }
    }

    printf("%d\n", m);
    for(int i = 0; i < m; i++)
    {
        printf("%d %d", mstep[i].e1 + 1, mstep[i].e2 + 1);
        printf("\n");
    }

    free(arr);free(add);free(mstep);

    return 0;
}